/**
 * Copyright(c) 2022 GOING INTERNATIONAL高盈国际
 * All Rights Reserved
 * @File        : swag.go
 * @Author      : zybin.zou
 * @Create      : 2022/6/29 18:35
 * @Modified    : 2022/6/29 18:35
 * @version     : 1.0
 * @Description :
 */

package swag

/*
#include <stdint.h>

extern uintptr_t NewSumObject();
extern int CSumAdd(uintptr_t object,int a, int b);
*/
import "C"

type ISum interface {
	Add(a, b int) int
}

type CSum uintptr

func NewCSum() ISum {
	ret := (ISum)(CSum(C.NewSumObject()))
	return ret
}

func (r CSum) Add(a, b int) int {
	ret := int(C.CSumAdd(C.uintptr_t(r), C.int(a), C.int(b)))
	return ret
}
